#include "IsoSurface.h"
#include "IsoBand.h"
#include "IsoLine.h"
#include "StreamLine.h"
#include "bz2decompress.h"
#include "decompressGz.h"
#include "GifEncode.h"

EMSCRIPTEN_BINDINGS(we)
{
    emscripten::register_vector<float>("vector<float>");
    emscripten::register_vector<double>("vector<double>");

    emscripten::class_<IsoSurface>("IsoSurface")
        .class_function("createInstance", &IsoSurface::createInstance, emscripten::allow_raw_pointers())
        .class_function("releaseInstance", &IsoSurface::releaseInstance, emscripten::allow_raw_pointers())
        .property("verbose", &IsoSurface::verbose)
        .property("bufferSize", &IsoSurface::bufferSize)
        .property("scale", &IsoSurface::scale)
        .property("offset", &IsoSurface::offset)
        .function("setImage", &IsoSurface::setImage)
        .function("getResult", &IsoSurface::getResult);

    emscripten::class_<IsoBand>("IsoBand")
        .class_function("createInstance", &IsoBand::createInstance, emscripten::allow_raw_pointers())
        .class_function("releaseInstance", &IsoBand::releaseInstance, emscripten::allow_raw_pointers())
        .function("isoBands", &IsoBand::isoBands)
        .function("test", &IsoBand::test);

    emscripten::class_<IsoLine>("IsoLine")
        .class_function("createInstance", &IsoLine::createInstance, emscripten::allow_raw_pointers())
        .class_function("releaseInstance", &IsoLine::releaseInstance, emscripten::allow_raw_pointers())
        .function("isoLines", &IsoLine::isoLines);
        
    emscripten::class_<StreamLine>("StreamLine")
        .class_function("createInstance", &StreamLine::createInstance, emscripten::allow_raw_pointers())
        .class_function("releaseInstance", &StreamLine::releaseInstance, emscripten::allow_raw_pointers())
        .function("setImage", &StreamLine::setImage)
        .function("run", &StreamLine::run);

    emscripten::class_<bz2decompress>("bz2decompress")
        .class_function("decompress", &bz2decompress::decompress);
    emscripten::class_<decompressGz>("decompressGz")
        .class_function("decompress", &decompressGz::decompress);

    emscripten::class_<GifEncode>("GifEncode")
        .class_function("createInstance", &GifEncode::createInstance, emscripten::allow_raw_pointers())
        .class_function("releaseInstance", &GifEncode::releaseInstance, emscripten::allow_raw_pointers())
        .class_function("run", &GifEncode::run);
}

int main(int, char **)
{
    // std::cout << "Hello, from we 1.0!\n";
}
